<?php

$this->breadcrumbs = array(
	$model->label(2) => array('index'),
	GxHtml::valueEx($model) => array('view', 'id' => GxActiveRecord::extractPkValue($model, true)),
	Yii::t('app', 'Update Diagrams'),
);

$this->menu = array(
	array('label'=>'Back', 'url'=>array($this->backurl),
		'linkOptions'=> array('class' => 'icon icon-arrow-left6 tb-gray'),
	),
	array('label'=>'Import New Image', 'url'=>array(""),
		'linkOptions'=> array('class' => 'icon icon-image4 tb-gray'),
	),
	array('label'=>'Draw New Diagram', 'url'=>array("drill/createdraw",'drill_id'=>$model->id),
		'linkOptions'=> array('class' => 'icon icon-design tb-gray'),
	),
);

?>

<h2 class="form-header">
	<?php
	echo CHtml::encode($this->pageTitle);
	?>
</h2>


<div class="form update-diagrams-form">

	<?php $form = $this->beginWidget('GxActiveForm', array(
		'id' => 'drillform',
		'enableAjaxValidation' => false,
	));
	?>

	<input type="hidden" name="do" value="">

	<?php echo $form->errorSummary($model); ?>

	<table class="form-grid">
		<?php $cnt=0; foreach($model->drillDiagrams as $d): $cnt++; ?>
		<tr>
			<td><label>Diagram #<?php echo $cnt ?></label></td>
			<td>
				<img src="./images/diagrams/<?php echo $d->id.".".$d->file_ext?>">
			</td>
			<td>
				<a onclick="drillform.submit()" class="form-button icon icon-arrow-up6 form-button-icon">Up</a>
				<a onclick="drillform.submit()" class="form-button icon icon-arrow-down6 form-button-icon">Down</a>
				<a onclick="drillform.submit()" class="form-button icon icon-bin2 form-button-icon">Remove</a>

				<?php
					$url=$this->createUrl("drill/updatedraw",array("id"=>$d["id"]));
					if(($d["type"]=="diag-half") || ($d["type"]=="diag-full")):
				?>
				<a href="<?php echo $url; ?>" class="form-button icon icon-pencil4 form-button-icon">Edit</a>
				<?php
					endif;
				?>
			</td>

		</tr>
		<?php endforeach; ?>
	</table>

	<?php
	$this->endWidget();
	?>
</div><!-- form -->